package com.zzy.weixin.controller;

import com.zzy.weixin.entity.Customer;
import com.zzy.weixin.service.customer.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhangzhiyi on 2017/5/23.
 */
@RestController
@RequestMapping("customer")
public class CustomerController {
    @Autowired
    CustomerService customerService;

    @GetMapping("{id}")
    public Customer customer(@PathVariable("id") String id){
        return customerService.findOne(id);
    }
    @GetMapping("")
    public List<Customer> getUsers(){
        return customerService.finAll();
    }
    @PostMapping("")
    public Customer addUser(@RequestBody Customer customer){
        return customerService.add(customer);
    }

}
